package gui;

import java.awt.GridBagConstraints;
import java.awt.Insets;

public class Constraints
{
	protected static GridBagConstraints gbc = new GridBagConstraints();

	//Method for setting constraint values.
	//When passing constraints with the add method for JComponents
	//You can pass the same constraint object so only need to 
	//set new values before passing it.
	protected static void setConstraints(int gridx, int gridy, int gridwidth, 
			int gridheight, double weightx, double weighty, int anchor,
	        int fill, Insets insets, int ipadx, int ipady)
	    {
			//GridX/Y determines where the component will go in the grid.
	    	gbc.gridx = gridx;
	    	gbc.gridy = gridy;
	    	//width/height determines how many grid units the component goes across.
	    	gbc.gridwidth = gridwidth;
	    	gbc.gridheight = gridheight;
	    	//weight determines how much space the component takes on window resize.
	    	gbc.weightx = weightx;
	    	gbc.weighty = weighty;
	    	//anchor determines which edge/corner the component will stick to.
	    	gbc.anchor = anchor;
	    	//fill determines whether and how the component fills the grid.
	    	gbc.fill = fill;
	    	//insets is an object instantiated by:
	    	//new Insets(int top, int left, int bottom, int right)
	    	//Each int value determines how many pixels the component
	    	//will be pushed in on the grid.
	    	gbc.insets = insets;
	    	//These int fields specify an increase or decrease in the horizontal and/or
	    	//vertical preferred size of the component.
	    	gbc.ipadx = ipadx;
	    	gbc.ipady = ipady;
	    }
}
